/**
 *
 */
package de.cbf.cam.dsa.services.impl.rcp_provider.factorys;

import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;

import de.cbf.cam.dsa.services.impl.rcp_provider.ProviderRCPStructure;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.RCPServiceImplExtensionPointResovler;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterStructure;
import de.cbf.cam.dsa.services.interfaces.rcp_provider.IServiceDSAProviderRCPStructure;

/**
 * @author salter
 *
 */
public class ServiceFactoryProviderRCPStructureDSA implements ServiceFactory<IServiceDSAProviderRCPStructure> {

	/**
	 *
	 */
	public ServiceFactoryProviderRCPStructureDSA() {
	}

	@Override
	public IServiceDSAProviderRCPStructure getService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderRCPStructure> registration) {
		return getService();
	}

	@Override
	public void ungetService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderRCPStructure> registration,
			IServiceDSAProviderRCPStructure service) {
	}

	public IServiceDSAProviderRCPStructure getService(){
		ProviderRCPStructure result = new ProviderRCPStructure();
		IRCPPersisterStructure persister = RCPServiceImplExtensionPointResovler.getInstance().getPreferredStructurePersister();
		result.setPersister(persister);
		return result;
	}
}
